<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>setter</title>
</head>
<body>

<div id="app">
    {{fullName}}
</div>

<script src="vue/vue.js"></script>
<script>
    var vm=new Vue({
        el:"#app",
        data:{
            firstName: "BRUCE",
            lastName: "LEE"
        },
        computed:{
            fullName:{
                get:function () {
                    return this.firstName+" "+this.lastName
                },
                set:function (newNames) {
                    var names=newNames.split(" ");
                    this.firstName=names[0];
                    this.lastName=names[names.length-1]
                }
            }
        }
    });
    setTimeout(function () {
        vm.fullName="PETER GREG"
    },2000)
</script>





</body>
</html>